package com.javasm.transfer;

import com.javasm.domin.entity.AftersaleB2cRetreat;
import com.javasm.domin.vo.AftersaleB2cRetreatVo;
import com.javasm.mapper.AdminMapper;
import com.javasm.transfer.base.BaseTransfer;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Component;

import java.util.List;

import static com.javasm.common.dictionary.AfterinitContext.afdic;

@Component
@RequiredArgsConstructor
public class AftersaleB2cRetreatTransfer extends BaseTransfer<AftersaleB2cRetreat, AftersaleB2cRetreatVo> {
    private final AdminMapper adminMapper;

    public List<AftersaleB2cRetreatVo> jotoVo(List<AftersaleB2cRetreat> aftersaleB2cRetreats){
        List<AftersaleB2cRetreatVo> aftersaleB2cRetreatVos = super.toVO(aftersaleB2cRetreats);
        for (int i = 0; i < aftersaleB2cRetreatVos.size(); i++) {
            AftersaleB2cRetreat aftersaleB2cRetreat = aftersaleB2cRetreats.get(i);
            AftersaleB2cRetreatVo aftersaleB2cRetreatVo = aftersaleB2cRetreatVos.get(i);
            if (aftersaleB2cRetreat.getRetreatType()!=null&&aftersaleB2cRetreat.getRetreatType()!=0){
                aftersaleB2cRetreatVo.setRetreatTypename(afdic.get(5).get(aftersaleB2cRetreat.getRetreatType()));
            }
            if (aftersaleB2cRetreat.getStockState()!=null&&aftersaleB2cRetreat.getStockState()!=0){
                aftersaleB2cRetreatVo.setStockStatename(afdic.get(4).get(aftersaleB2cRetreat.getStockState()));
            }
            if (aftersaleB2cRetreat.getBatchState()!=null&&aftersaleB2cRetreat.getBatchState()!=0){
                aftersaleB2cRetreatVo.setBatchStatename(afdic.get(2).get(aftersaleB2cRetreat.getBatchState()));
            }
            if (aftersaleB2cRetreat.getNumberState()!=null&&aftersaleB2cRetreat.getNumberState()!=0){
                aftersaleB2cRetreatVo.setNumberStatename(afdic.get(3).get(aftersaleB2cRetreat.getNumberState()));
            }
        }
        return aftersaleB2cRetreatVos;
    }
}
